package com.qiao.glod.view.item;

import android.content.Context;
import android.graphics.Bitmap;
import android.util.AttributeSet;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;

import com.qiao.glod.R;

/**
 * Created by Qiao on 2016/4/16.
 * function：
 */
public class MenuHeader extends FrameLayout implements View.OnClickListener{
    private View contentView;
    private ImageView mCoverImage,mPhotoImage;
    private TextView mDesText;

    public MenuHeader(Context context) {
        super(context);
        initialize();
    }

    public MenuHeader(Context context, AttributeSet attrs) {
        super(context, attrs);
        initialize();
    }

    public MenuHeader(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initialize();
    }

    private void initialize(){
        contentView = View.inflate(getContext(),R.layout.fragment_drawer_header,this);
        mCoverImage = findView(R.id.img_cover);
        mPhotoImage = findView(R.id.imge_photo);
        mDesText = findView(R.id.text_dec);

        mPhotoImage.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {

    }

    protected <T extends View> T findView(int resId) {
        return (T) contentView.findViewById(resId);
    }

    public ImageView getCoverImage(){
        return mCoverImage;
    }

    public void setBackgroundCover(Bitmap bitmap){
        mCoverImage.setImageBitmap(bitmap);
    }

    public ImageView getPhotoImage(){
        return mPhotoImage;
    }

    public void setDesText(String text){
        mDesText.setText(text);
    }
}
